<template>
	<view class="content">
		<text class="title">有什么都可以告诉我们噢~</text>
		<u--textarea v-model="value" placeholder="请输入内容" height="200"></u--textarea>
		<u-button type="primary" text="提交" shape="circle" @click="submit" class="btn"></u-button>
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				value: "",
			}
		},
		methods: {
			async submit() {
				const res = await this.$api.addMessage({
					messageUserId: uni.getStorageSync('user').id,
					messageContent: this.value,
				})
				// console.log(res)
				this.$refs.uToast.show({
					type: 'success',
					message: '提交成功！',
				})
				setTimeout(() => {
					uni.navigateBack()
				}, 2000)
			},
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		display: flex;
		flex-direction: column;
		background-color: #fff;
		box-sizing: border-box;
		padding: 40rpx;

		.title {
			font-weight: bold;
			font-size: 38rpx;
			margin: 40rpx 0;
		}

		.btn {
			margin-top: 60rpx;
		}
	}
</style>